package br.ufg.inf.espweb.sgca.web.navegacao;

import java.io.IOException;
import java.io.Serializable;
import org.omnifaces.util.Faces;

/**
 *
 * @author diCastro
 */
public class Navegacao implements Serializable{
    
    public static final String HOME;
    public static final String LOGIN;
    private static String contextPath;
    
    static {
        HOME = "/sistema/home.jsf";
        LOGIN = "/login.jsf";
    }
    
    public static void home(){
        redirectTo(HOME);
    }
    
    private static void redirectTo(String pagina) {
        if (contextPath == null)
            contextPath = Faces.getServletContext().getContextPath();
        try {
            Faces.redirect(contextPath + pagina);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
